﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Framework
{
    [Map("FrameworkTemplate")]
    public class Template
    {
    }

    public class ControlTemplate : Template
    {
        public Type TargetType { get; set; }
    }

    public class ItemsPanelTemplate : Template
    {
        
    }

    public class DataTemplate : Template
    {
        public UIElement LoadContent()
        {
            throw new NotImplementedException();
        }
    }


    public class HierarchicalDataTemplate : DataTemplate
    {
        public Style ItemContainerStyle;
        public Binding ItemsSource;
        public DataTemplate ItemTemplate;
    }


    public sealed class Style : Base
    {
        private Collection<Setter> setters = new Collection<Setter>();

        public Boolean IsSealed { get; private set; }
        public Collection<Setter> Setters { get { return setters; } }
        public Style BasedOn { get; set; }
        public Type TargetType { get; set; }

        public Style() { ; }
        
        public void Seal()
        {
            
        }
    }

    public class Setter : Base
    {
        object val;
        public int Property { get; set; }
        public bool IsSealed { get; set; }

        public object Value
        {
            get { return val; }
            set
            {
                if (IsSealed == true)
                    throw new InvalidOperationException();
                else val = value;
            }
        }

        public Setter() { ; }

        public Setter(int property, Object value)
        {
            Property = property; Value = value;
        }
    }
}
